<template>
  <!--设备运行记录-->
  <div style="padding: 20px">
    <el-card class="box-card">
      <el-button-group style="margin-bottom: 20px">
        <el-dropdown @command="handleCommand" style="margin-left: 15px">
          <span class="el-dropdown-link">
            <el-button type="primary">
              新增<i class="el-icon-arrow-down el-icon--right"></i>
            </el-button>
          </span>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item command="a">领用出库</el-dropdown-item>
            <el-dropdown-item command="b">普通出库</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
        <el-button style="margin-left: 15px">删除</el-button>
        <el-button style="margin-left: 15px">导出</el-button>
        <el-input placeholder="请输入设备编号或名称" clearable prefix-icon="el-icon-search" suffix-icon="el-icon-s-cale"
          style="width: 250px; margin-left: 570px" />
        <el-popover placement="right" width="400" trigger="click">
          <svg-icon icon-class="caiss" style="width: 40px; height: 20px" class="pointer" slot="reference" />
        </el-popover>
      </el-button-group>
      <el-table :data="data" stripe style="width: 100%">
        <el-table-column type="selection" width="55"></el-table-column>
        <el-table-column type="index" label="序号" width="50"></el-table-column>
        <el-table-column label="操作" width="100">
          <template v-slot="scope">
            <el-button type="text" @click="viewDetail(scope.row)">查看</el-button>
          </template>
        </el-table-column>
        <el-table-column prop="orderNumber" label="单据编号"></el-table-column>
        <el-table-column prop="orderDate" label="单据日期"></el-table-column>
        <el-table-column prop="registrant" label="登记人"></el-table-column>
        <el-table-column prop="department" label="所在部门"></el-table-column>
        <el-table-column prop="equipmentName" label="设备名称"></el-table-column>
        <el-table-column prop="model" label="规格型号"></el-table-column>
        <el-table-column prop="equipmentType" label="设备类型"></el-table-column>
        <el-table-column prop="location" label="存放位置"></el-table-column>
        <el-table-column prop="location" label="使用部门"></el-table-column>
        <el-table-column prop="location" label="设备开机人"></el-table-column>
        <el-table-column prop="location" label="设备关机人"></el-table-column>
        <el-table-column prop="location" label="设备开机时间"></el-table-column>
        <el-table-column prop="location" label="设备关机时间"></el-table-column>
        <el-table-column prop="location" label="累计运行时长(h)"></el-table-column>
        <el-table-column prop="location" label="停机时长(h)"></el-table-column>
        <el-table-column prop="location" label="实际运行时长(h)"></el-table-column>
        <el-table-column prop="location" label="计划运行时长"></el-table-column>
        <el-table-column prop="location" label="生产班组"></el-table-column>
        <el-table-column prop="location" label="班次时间"></el-table-column>
        <el-table-column prop="location" label="生产日期"></el-table-column>
        <el-table-column prop="location" label="生产产品"></el-table-column>
        <el-table-column prop="location" label="生产总数量"></el-table-column>
        <el-table-column prop="location" label="合格品数量"></el-table-column>
        <el-table-column prop="location" label="不合格品数量"></el-table-column>
        <el-table-column prop="location" label="合格率"></el-table-column>
        <el-table-column prop="location" label="理想速度(件/h)"></el-table-column>
        <el-table-column prop="location" label="OEE"></el-table-column>
        <el-table-column prop="location" label="备注"></el-table-column>
      </el-table>

      <el-pagination background style="margin-top: 20px; text-align: right" :page-size="10" :total="45"
        layout="prev, pager, next, sizes, total" :page-sizes="[10, 20, 30, 50]" />
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      data: [
        {
          orderNumber: "N0TZ370W-001",
          orderDate: "2025-07-12",
          registrant: "刑素怀",
          department: "生产部门",
          equipmentName: "数控车床",
          model: "CNC-500",
          equipmentType: "生产车间",
          location: "生产车间",
        },
        {
          orderNumber: "N0TZ370W-001",
          orderDate: "2025-07-12",
          registrant: "刑素怀",
          department: "生产部门",
          equipmentName: "数控车床",
          model: "CNC-500",
          equipmentType: "生产车间",
          location: "生产车间",
        },
        {
          orderNumber: "N0TZ370W-001",
          orderDate: "2025-07-12",
          registrant: "刑素怀",
          department: "生产部门",
          equipmentName: "数控车床",
          model: "CNC-500",
          equipmentType: "生产车间",
          location: "生产车间",
        },
        {
          orderNumber: "N0TZ370W-001",
          orderDate: "2025-07-12",
          registrant: "刑素怀",
          department: "生产部门",
          equipmentName: "数控车床",
          model: "CNC-500",
          equipmentType: "生产车间",
          location: "生产车间",
        },
        {
          orderNumber: "N0TZ370W-001",
          orderDate: "2025-07-12",
          registrant: "刑素怀",
          department: "生产部门",
          equipmentName: "数控车床",
          model: "CNC-500",
          equipmentType: "生产车间",
          location: "生产车间",
        },
        {
          orderNumber: "N0TZ370W-001",
          orderDate: "2025-07-12",
          registrant: "刑素怀",
          department: "生产部门",
          equipmentName: "数控车床",
          model: "CNC-500",
          equipmentType: "生产车间",
          location: "生产车间",
        },
      ],
    };
  },
  methods: {
    handleCommand(command) {
      if (command === 'a') {
        this.$router.push({ path: "/bei/ku/chu/yong" });
      } else if (command === 'b') {
        this.$router.push({ path: "/bei/ku/chu/pt" });
      }
    },
    viewDetail(row) {
      console.log("查看详情", row);
      this.$router.push({ path: "/sb/dang/ji/cha" });
    },
    dian() {
      this.$router.push({ path: "/sb/dang/ji/xin" });
    },
  },
};
</script>

<style scoped>
.text {
  font-size: 14px;
}

.item {
  padding: 18px 0;
}

.box-card {
  width: 1210px;
  height: 660px;
  margin-left: 14px;
}

.el-dropdown-link {
  cursor: pointer;
  color: #409EFF;
}

.el-icon-arrow-down {
  font-size: 12px;
}
</style>
